<template>
    <div class="userCenter">
        <div class="breadcrumb-box">
            <el-breadcrumb separator-class="el-icon-arrow-right">
                <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                <el-breadcrumb-item>个人中心</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="center container td-f">
            <left-nav-bar :active="active"></left-nav-bar>
            <div class="right">
                <div class="border1">
                    <div class="w33" @click="navDetail(0)" style="cursor:pointer">
                        <div>待付账单</div>
                        <div>{{userInfo.daifu?userInfo.daifu:'0'}}</div>
                    </div>
                    <div class="w33" style="cursor:pointer" @click="navDetail(1)">
                        <div>未出账单</div>
                        <div>{{userInfo.weichu?userInfo.weichu:'0'}}</div>
                    </div>
                    <div class="w33">
                        <div>我的月结日</div>
                        <div>{{userInfo.date?userInfo.date:'暂无'}}</div>
                    </div>
                    <div class="w33">
                        <div>月结状态</div>
                        <div v-if="userInfo.allow == 3">账户已被冻结</div>
                        <div v-else>{{userInfo.allow == 1?'月结已开通':'月结未开通'}}</div>
                    </div>
                </div>
                <div class="choose">
                    <div class="green" @click="payMonth">还款</div>
                    <div class="blue" @click="billList">账单明细</div>
                    <div class="red" @click="openMonth">开通月结</div>
                </div>
            </div>
        </div>
        <div style="height: 200px"></div>
    </div>
</template>

<script>
import leftNavBar from "@components/leftNavBar";
import { getUser, getMyMessage, searchQuota } from "@api/user";

export default {
    name: "userCenter",
    data() {
        return {
            loading: false,
            active: 1,
            userInfo: {},
            messageList: [],
            quotaInfo: "",
            orderStatusNum: {},
        };
    },
    components: {
        leftNavBar,
    },
    methods: {
        //

        navDetail(index) {
            this.$router.push({
                path: "/waitPaymentList",
                query: {
                    index: index,
                },
            });
        },
        // 跳转支付金额页面
        payMonth() {
            if (this.userInfo.allow == 0) {
                this.$confirm("您未开通月结账户，是否开通?", "提示", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning",
                })
                    .then(() => {
                        this.$router.push({ path: "/openMonth" });
                    })
                    .catch(() => {
                       
                    });
                return;
            }
            if (this.userInfo.allow == 3) {
                return this.$dialog.toast({ mes: "您的月结账户已冻结" });
            }
            this.$router.push({
                path: "/payMonth",
            });
        },
        // 跳转账单明细
        billList() {
            if (this.userInfo.allow == 0) {
                return this.$dialog.toast({ mes: "请先开通月结" });
            }
            this.$router.push({
                path: "/billDetail",
            });
        },
        // 开通月结页面
        openMonth() {
            this.$router.push({
                path: "/openMonth",
            });
        },
        User() {
            let that = this;
            getUser().then((res) => {
                that.userInfo = res.data.month;
            });
        },
    },
    mounted() {
        this.User();
    },
};
</script>

<style scoped  rel="stylesheet/scss" lang="scss" scoped>
$color: #da213d;
.userCenter {
    width: 100%;
    height: 100%;

    .center {
        /*width: 70%;*/
        margin: 0 auto;
        display: flex;

        .right {
            width: 1000px;
            margin-left: 32px;
            /*margin-top: 90px;*/
            .choose {
                margin-top: 136px;
                .green {
                    cursor: pointer;
                    width: 230px;
                    height: 50px;
                    background: #45b39c;
                    border-radius: 5px;
                    font-size: 18px;
                    font-weight: bold;
                    text-align: center;
                    color: #ffffff;
                    line-height: 50px;
                    margin: 0 auto;
                }
                .red {
                    cursor: pointer;
                    margin: 30px auto 0;
                    width: 230px;
                    height: 50px;
                    background: #da213d;
                    border-radius: 5px;
                    font-size: 18px;
                    font-weight: bold;
                    text-align: center;
                    color: #ffffff;
                    line-height: 50px;
                }
                .blue {
                    cursor: pointer;
                    margin: 30px auto 0;
                    width: 230px;
                    height: 50px;
                    background: #3ca9d7;
                    border-radius: 5px;
                    font-size: 18px;
                    font-weight: bold;
                    text-align: center;
                    color: #ffffff;
                    line-height: 50px;
                }
            }
            .border1 {
                border: 1px solid #efc2c1;
                display: flex;
                height: 130px;
                .w33 {
                    width: 25%;
                    display: flex;
                    flex-direction: column;
                    justify-content: center;
                    align-items: center;
                    position: relative;
                    &:last-child {
                        &::before {
                            display: none;
                        }
                    }
                    &::before {
                        position: absolute;
                        right: 0;
                        top: 0;
                        bottom: 0;
                        margin: auto 0;
                        width: 2px;
                        height: 47px;
                        background: #ecdfdd;
                        border-radius: 1px;
                        content: "";
                    }
                    > div {
                        &:nth-child(1) {
                            font-size: 18px;
                            text-align: center;
                            color: #666666;
                        }
                        &:nth-child(2) {
                            margin-top: 14px;
                            font-size: 20px;
                            font-weight: bold;
                            text-align: center;
                            color: #da213d;
                        }
                    }
                }
            }
            .ti-top {
                border: 1px solid #efc2c1;
                border-top-left-radius: 5px;
                border-top-right-radius: 5px;
                .right-top {
                    display: flex;
                    height: 160px;
                    align-items: center;
                    background: url("../../assets/second_icon/center_bg.png")
                        no-repeat;
                    background-size: 100% 100%;
                    position: relative;

                    .left-ava {
                        margin-left: 55px;
                        width: 82px;
                        height: 82px;
                        border-radius: 50%;
                        display: flex;
                        justify-content: center;
                        align-items: center;
                        background-color: #fff;
                        box-shadow: inset 0 0 5px 1px
                            rgba($color: #000000, $alpha: 0.2);
                        img {
                            width: 74px;
                            height: 74px;
                            border-radius: 50%;
                        }
                    }
                    .detaiult-avatar {
                        margin-left: 55px;
                        width: 99px;
                        height: 99px;
                        border-radius: 50%;
                        background-color: #fff;
                        box-shadow: inset 0 0 5px 1px
                            rgba($color: #000000, $alpha: 0.2);
                        img {
                            width: 66px;
                            height: 66px;
                            margin-left: 10px;
                        }
                    }

                    .right-txt {
                        display: flex;
                        height: 99px;
                        justify-content: center;
                        align-items: center;
                        margin-left: 5px;

                        > div:nth-of-type(1) {
                            color: #ffffff;
                            font-size: 20px;
                            margin-left: 20px;
                            text-align: justify;
                        }

                        > div:nth-of-type(2) {
                            height: 32px;
                            line-height: 32px;
                            padding: 0 20px;
                            text-align: center;
                            margin-left: 20px;
                            background: linear-gradient(
                                270deg,
                                rgba(23, 22, 20, 0.3) 1%,
                                rgba(99, 77, 77, 0.3)
                            );
                            border-radius: 15px;
                            color: rgba(255, 255, 255, 1);
                            font-size: 18px;
                            // margin-top: 19px;
                            small {
                                padding-right: 2px;
                            }
                        }
                    }

                    .set-btn {
                        position: absolute;
                        right: 30px;
                        top: 50%;
                        width: 70px;
                        height: 30px;
                        font-size: 16px;
                        color: #fff;
                        cursor: pointer;
                        border-radius: 8px;
                        border: 1px solid #da213d;
                        background: #da213d;
                        transform: translateY(-50%);
                        transition: all 0.3s;
                    }

                    .set-btn:hover {
                        background: #fff;
                        color: #da213d;
                    }
                }

                .right-list {
                    display: flex;
                    height: 130px;
                    width: 100%;
                    align-items: center;
                    justify-content: space-around;
                    // margin: 0 auto;
                    cursor: pointer;

                    .li {
                        display: flex;
                        flex-direction: column;
                        width: 33.3%;
                        justify-content: center;
                        align-items: center;
                        position: relative;
                        &::before {
                            position: absolute;
                            right: 0;
                            top: 0;
                            bottom: 0;
                            margin: auto 0;
                            content: "";
                            width: 2px;
                            height: 47px;
                            background: #ecdfdd;
                            border-radius: 1px;
                        }
                        > div:nth-of-type(1) {
                            min-width: 25px;
                            height: 25px;
                            line-height: 25px;
                            text-align: center;
                            background-color: $color;
                            color: #ffffff;
                            font-size: 15px;
                            position: absolute;
                            z-index: 2;
                            border-radius: 50%;
                            margin: -40px 0 0 30px;
                        }

                        img {
                            width: 50px;
                            height: 41px;
                            object-fit: contain;
                        }

                        div:nth-of-type(2) {
                            color: rgba(102, 102, 102, 1);
                            font-size: 17px;
                            font-family: MicrosoftYaHei;
                            margin-top: 13px;
                        }
                    }

                    .li:last-child {
                        img {
                            max-width: 54px;
                        }
                        &::before {
                            display: none;
                        }
                    }
                }
            }

            .line-ti {
                width: 100%;
                border-bottom: 3px solid #dbdbdb;
                margin-top: 50px;
                height: 40px;
                > div {
                    color: rgba(61, 117, 175, 1);
                    font-size: 18px;
                    font-family: MicrosoftYaHei-Bold;
                    border-bottom: 3px solid $color;
                    width: 72px;
                    height: 40px;
                    line-height: 36px;
                    padding-left: 18px;
                }
            }

            .shop-list {
                .shop-li {
                    padding-bottom: 10px;

                    .top {
                        display: flex;
                        align-content: center;
                        justify-content: space-between;
                        margin: 30px 0 16px 0;

                        .le {
                            display: flex;
                            height: 24px;
                            align-items: center;

                            img {
                                width: 18px;
                                height: 16px;
                            }

                            > div {
                                color: rgba(51, 51, 51, 1);
                                font-size: 17px;
                                font-family: MicrosoftYaHei;
                                padding-left: 12px;
                            }
                        }

                        .ri {
                            > div {
                                color: #999999;
                            }
                        }
                    }

                    .bot {
                        width: 100%;
                        height: 40px;
                        display: flex;
                        justify-content: space-between;
                        align-items: center;

                        .l {
                            display: flex;
                            height: 80px;
                            align-items: center;
                            margin-left: 15px;

                            img {
                                width: 80px;
                                height: 80px;
                            }

                            > div {
                                color: #333333;
                                padding-left: 15px;
                                font-size: 16px;
                                font-weight: 500;
                                width: 500px;
                                overflow: hidden;
                                text-overflow: ellipsis;
                                white-space: nowrap;
                            }
                        }

                        .r {
                            width: 85px;
                            height: 30px;
                            line-height: 30px;
                            text-align: center;
                            background: $color;
                            color: #3d75af;
                            font-size: 14px;
                            margin-right: 15px;
                            border-radius: 2px;
                            cursor: pointer;
                        }
                    }
                }

                .shop-li:not(:last-child) {
                    border-bottom: 1px solid #dbdbdb;
                }
            }
        }
    }
}
</style>
